package org.helgoboss.janana_database

import org.helgoboss.osgi_additions.{OsgiProvider, OsgiContext, OsgiConsumer}
import org.helgoboss.document_database_orient_impl.UseLocalOrientDatabase
import org.helgoboss.document_database.UseDatabase
import org.helgoboss.janana.Janana
import java.io.File

class JananaDatabase extends OsgiProvider with OsgiContext with OsgiConsumer {
    def janana = requiredService[Janana]
    
    def jananaDatabaseHome = new File(janana.getUserDataDir, "var/database")
    
    whenBundleActive {
        new UseLocalOrientDatabase(jananaDatabaseHome).providesService[UseDatabase]
    }
}